import { createBrowserRouter, redirect} from "react-router-dom";
import AppLayout from "../layout";
import Login from "@/pages/login";
import User from "@/pages/system/user";
import Home from "@/pages/home";
import Menu from "@/pages/system/menu";
import AuthRoute from './authRouter';
import Tang from "@/pages/poetry/tang";
const routes = [
    { 
        path: "/", 
        element: <AuthRoute><AppLayout /></AuthRoute>,
        hidden: true,
        children:[{
            path: "/home",
            element:<Home />
        }],
        redirect: "/home"
    },
    {
        path: "/login",
        element: <Login />,
        children: []
    },
    {
        path: "/system",
        element: <AuthRoute><AppLayout /></AuthRoute>,
        children: [
            {
                path: "/system/user",
                element:<User />
            },
            {
                path: "/system/menu",
                element:<Menu />
            }
        ]
    },
    {
        path: "/poetry",
        element: <AuthRoute><AppLayout /></AuthRoute>,
        children: [
            {
                path: "/poetry/tang",
                element:<Tang />
            },
        ]
    }
    // { path: "*", element: <div>404</div> }
]
const routers = createBrowserRouter(routes)

export { routes };

export default routers;